from sklearn.neighbors import KernelDensity


class WFEstDensity:
    def __init__(self, kernel='gaussian', bandwidth=2.0):
        self.kernel = kernel
        self.bandwidth = bandwidth
        self.kde = None

    def fit(self, x):
        self.kde = KernelDensity(kernel=self.kernel, bandwidth=self.bandwidth).fit(x)
        return self.kde
